package com.cuhk.gulimall.product.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

import lombok.Data;

/**
 * spu信息介绍
 * 
 * @author chenyuijing
 * @email torchsam@aliyun.com
 * @date 2024-06-10 11:23:16
 */
@Data
@TableName("pms_spu_info_desc")
public class SpuInfoDescEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 商品id
	 */
	// 主键不是自增的, 根据我们传入的来
	@TableId(type = IdType.INPUT)
	private Long spuId;
	/**
	 * 商品介绍
	 */
	private String decript;

	@TableField(exist = false)
	private List<String> descriptionList;

	public void fillDescriptionList() {
		if(decript != null){
			descriptionList = Arrays.asList(decript.split(","));
		}
		else {
			descriptionList = Arrays.asList(new String[]{"default.png"});
		}
	}

}
